package com.kaigejava.DecoratorModelzhuangshizhe.coffeebar.seasoning;

import com.kaigejava.DecoratorModelzhuangshizhe.coffeebar.DrinkComponent;

/**
 * Created by kaigejava on 2019/8/13.
 * 调料的超类-调料对象
 */
public abstract  class Seasoning extends DrinkComponent {
    /**
     * 被装饰的对象。也是饮料超类对象子类
     */
    private DrinkComponent drinkComponent;

    public Seasoning(DrinkComponent drinkComponent){
        this.drinkComponent = drinkComponent;
    }

    @Override
    public Float cost() {
        return super.getPrice()+drinkComponent.cost();
    }

    @Override
    public String getDescription(){
        return super.description +".价格为:"+super.getPrice()+"&&"+drinkComponent.getDescription();
    }
}
